package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.HashMap;
import java.util.Map;

@Setter
@Getter
@ToString
public class Strategy extends BaseDomain {

    public static final int STATE_DISABLE=-1;
    public static final int STATE_NOMAL=0;
    public static final int STATE_HOT=1;

    private Region place;

    private String title;
    //副标题
    private String subTitle;
    //封面
    private String coverUrl;
    //状态
    private Integer state;
    //收藏
    private Favorites favorites;


   //创建getJson的时候,如果是对象,应该判断之后再普通进去
   public String getJson(){
       Map<String,Object> map=new HashMap<>();
       map.put("id", id);
       map.put("title", title);
       map.put("subTitle", subTitle);
       map.put("coverUrl",coverUrl);
       map.put("state",state);
       //当我们封装的是对象的时候,我么你需要判断一下是否存在
       if(place!=null){
           map.put("placeId",place.getId());
           map.put("placeName",place.getName());

       }
       return JSONUtil.toJSONString(map);
   }
}